#pragma once
#include "BasicFunction.h"
#include "ImageLab.h"
#include "MultiscaleNet.h"
#include "SOM.h"
#include "Hebbian.h"
using namespace std;

class CMultiscaleCrossModal
{
public:
	//Constructor
	CMultiscaleCrossModal(_3dpoint size1, _2dpoint size2, unsigned int datadimension1, unsigned int datadimension2, vector<double>
		maxvalue1, vector<double> minvalue1, vector<double> maxvalue2, vector<double> minvalue2, unsigned int traincycle);
	CMultiscaleCrossModal(string firstnetfile, string secondnetfile, string hebbiannetfile);
	~CMultiscaleCrossModal(void);

private:
	//First multiscale net for images
	MultiscaleNet* firstnet;
	//Second net: single som for linguistic
	CSOM*			secondnet;
	//Hebbian links between the two nets
	CHebbian*		hebbianlink;
	//Some basic functions
	CBasicFunction bf;

	//Maximum training cycle
	unsigned int maxcycle;

	//Size of the two maps
	_2dpoint	sizeoffirstnet;
	_2dpoint	sizeofsecondnet;

	//3D size of the first map
	_3dpoint	sizeofmultiscalesom;

public:
	//Train the cross modal
	void	NetTraining(vector<vector<vector<double>>> netinput1, vector<vector<double>> netinput2);

	//Get the cross link winners
	_2dpoint	GetCrossLink1(vector<double> input);
	_2dpoint	GetCrossLink2(vector<vector<double>> input);
	_2dpoint	GetCrossLink1(_2dpoint position2);
	_2dpoint	GetCrossLink2(_2dpoint position1);

	//Get the winners of each net
	_2dpoint	GetWinner1(vector<vector<double>> input);
	_2dpoint	GetWinner2(vector<double> input);

	//Get the size of the map
	_2dpoint	GetMapSize1();
	_2dpoint	GetMapSize2();

	//Save the data of the net
	void	SaveCrossModalToFile(string firstfile, string secondfile, string hebbianfile);
};
